#ifndef BOOK_H
#define BOOK_H

#include "protocol.h"
#include "mybar.h"
#include <QWidget>
#include <QListWidget>
#include <QPushButton>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QFile>


class Book : public QWidget
{
    Q_OBJECT
public:
    explicit Book(QWidget *parent = nullptr);
    void updateFileList(const PDU *pdu);
    void setDownloadStatus(bool status);
    bool getDownloadStatus();
    qint64 m_iTol;
    qint64 m_iRecived;
    QString m_strUploadFilePath;
    QString m_strSaveFilePath;
    QString m_strShareFileName;
    QString m_strMoveFileName;
    QString m_strMoveFilePath;
    QString m_strDestDir;
signals:

public slots:
    void createDir();
    void flushFile();
    void delDir();
    void renameFile();
    void enterDir(QListWidgetItem* caName);
    void returnPreDir();

    void uploadFile();
    void uploadFileData();
    void showUploadFileDataProgress(qint64 isRecived);
    void hideBar();
    void delfile();
    void downloadfile();
    void shareFile();
    void moveFile();
    void selectDestDir();

private:
    QListWidget * m_pBookListW;

    QPushButton *m_pRetrunPB;
    QPushButton *m_pCreateDirPB;
    QPushButton *m_pDelDirPB;
    QPushButton *m_pRenamePB;
    QPushButton *m_pFlushFilePB;
    QPushButton *m_pUploadPB;

    QPushButton *m_pDownLoadPB;
    QPushButton *m_pDelFilePB;
    QPushButton *m_pShareFilePB;
    QPushButton *m_pMoveFilePB;
    QPushButton *m_pSelectDirFilePB;


    bool m_bDownload;
    mybar *m_pBar;



    qint64 m_iTotal;
    qint64 m_iRecved;
};

#endif // BOOK_H
